using AIFSContentManagementSystem.Criteria;
using AIFSDataAccessLayer.Utilities;

namespace AIFSCMS.Infrastructure.EntityMappers
{
    /// <summary>
    /// Helper class to Serialize Criteria to/from xml
    /// </summary>
    public sealed class ExpressionElementMapper : EntityMapper<ExpressionElement>
    {
        protected override void Map(System.Data.DataRow drEntity, ExpressionElement dto)
        {
            dto.DataType = DataTableUtil.ToStringType(drEntity, "TYPE");
            dto.ExpressionId = DataTableUtil.ToIntType(drEntity, "EXPRESSION_ID");
            dto.CriteriaId = DataTableUtil.ToIntType(drEntity, "CRITERIA_ID");
            dto.LeftOperand = DataTableUtil.ToStringType(drEntity, "LEFT_OPERAND");
            dto.Oper = DataTableUtil.ToStringType(drEntity, "OPER");
            dto.RightOperand = DataTableUtil.ToStringType(drEntity, "RIGHT_OPERAND");
        }
    }
}
